﻿@model IEnumerable<Backend.JYD.Model.Cust.CustBase>
@using Backend.JYD.Business
@using Backend.JYD.Model
@using Backend.JYD.BLL
@using Backend.JYD.Web.Common
@{
    ViewBag.Title = "意向客户管理";
    ViewBag.CurrMenu = "mu02";
}
@*
<script type="text/javascript">
    $(document).ready(function () {
        $("#txtStartDate").focus(function () {
            WdatePicker();
        });
        $("#txtEndDate").focus(function () {
            WdatePicker();
        });
    });
</script>
*@
<div class="frame-tit">
    <span class="ico-left"></span>
    <div class="title">@ViewBag.Title</div>
    <span class="ico-right"></span>
    <div class="title-side blu line">
        @*<input type="button" onclick="openNew();" value="创建新意向" class="blu"/>*@
    </div>
</div>
<div class="frame-cont">
    <h2>查询条件</h2>
    <ul class="edit-ul">
        <li class="li01">
            证件类型：@Html.DropDownList("papertype", JydHtmlHelper.ConvertItemFormCodeInfo("请选择", CodeManager.PaperType, ViewBag.PaperType as string), new { @class = "wid100" })
            证件号码：<input type="text" style="width:120px;" name="paperno" id="paperno" value="@ViewBag.PaperNo"/>
            意向Id：<input  type="text" name="intentid" id="intentid" value="@ViewBag.IntentId"  readonly="readonly"  class="wid100"/>
        </li>
        <li class="li01">
            客户号：<input type="text" style="width:120px;" name="custno" id="custno" value="@ViewBag.CustNo"/>
            客户姓名：<input type="text" style="width:120px;" name="name" id="name" value="@ViewBag.CustName"/>
            客户电话：<input type="text" style="width:120px;" name="phone" id="phone" value="@ViewBag.Phone"/>
        </li>
        <li class="li01">
            <span class="s01"></span>
            <span class="s02">
                <input type="button" onclick="loadpage();" value="查询"/>
            </span>
        </li>
    </ul>
    <p>
        @Html.Hidden("hidPageIndex", ViewBag.PageIndex as string)
    </p>
    <h2>我的意向列表</h2>
    <table class="table1" width="100%" border="0" cellpadding="0" cellspacing="1">
        <thead>
            <tr>
                <th width="3%"><div class="th1"></div></th>
                <th width="10%"><div class="th1">客户号</div></th>
                <th width="10%"><div class="th1">客户姓名</div></th>
                <th width="10%"><div class="th1">电话</div></th>
                <th width="10%"><div class="th1">操作人</div></th>
                <th width="14%"><div class="th1">操作</div></th>
            </tr>
        </thead>
        <tbody>
        @if(Model != null){
            int idx =0;
            //var dic = JydHtmlHelper.ConvertDictionaryFormEnumType<TaskManager.TaskStatus>();
            var empinfos = this.ViewBag.EmpInfos as List<EmpInfo>;
            var bll = new EmpInfoBLL();
            foreach (var item in Model)
            {
                idx++;
            <tr>
                <td>@idx</td>
                <td>@item.CustNo</td>
                <td>@item.CustName</td>
                <td>@item.Phone</td>
                <td>@(item.OpId.HasValue ? bll.GetEmpNameById(empinfos, item.OpId.Value) : string.Empty)</td>
                 <td>
                 
                </td>
            </tr>
            }
            }
        </tbody>
    </table>
    @{
            Html.RenderPartial("_Pager");
        }
 </div>
@* <script src="@Url.Content("~/skin/datepicker/WdatePicker.js")" type="text/javascript"></script>*@
<script type="text/javascript">
    
    function openEdit(id) {
        //windowShowModalDialog("/intent/edit?intentid=" + id, window, 600, 750);
    }
    
    function loadpage() {
        var papertype = $("#papertype").val();
        var paperno = $("#paperno").val();
        var intentid = $("#intentid").val();
        var custno = $("#custno").val();
        var name = $("#name").val();
        var phone = $("#phone").val();
        var page = $("#hidPageIndex").val();
        if (!page) page = 1;
        url = "/cust/intentcust?page=" + page;
        if (papertype) {
            url += "&ptype=" + papertype;
        }
        if (paperno) {
            url += "&pno=" + paperno;
        }
        if (intentid) {
            url += "&intentId=" + intentid;
        }
        if (custno) {
            url += "&no=" + custno;
        }
        if (name) {
            url += "&name=" + escape(name);
        }
        if (phone) {
            url += "&phone=" + phone;
        }
        window.location = url;
    }
</script>


